<%@ page import="org.ikastola.Student" %>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'student.label', default: 'Student')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<a href="#list-student" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
				<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
				<li><a class="list"> <g:message code="default.search.label"/> por Curso: </a></li>
				<g:form name="search" url="[action:'listc',controller:'student']">
					<li><select name="id">
						<g:each in="${org.ikastola.Course.list()}">
							<g:if test="${it.id == courseid}">
								<option value="${it.id}" selected>${it.name} ${it.division}</option>
							</g:if>
							<g:else>
								<option value="${it.id}">${it.name} ${it.division}</option>
							</g:else>
						</g:each>
						</select>
						<input type="submit"/>
					</li>
				</g:form>
			</ul>
		</div>
		<div id="list-student" class="content scaffold-list" role="main">
			<h1><g:message code="default.list.label" args="[entityName]" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<table>
				<thead>
					<tr>
					
						<g:sortableColumn property="name" title="${message(code: 'student.name.label', default: 'Name')}" />
					
						<g:sortableColumn property="lastname" title="${message(code: 'student.lastname.label', default: 'Lastname')}" />
					
						<g:sortableColumn property="doctype" title="${message(code: 'student.doctype.label', default: 'Doctype')}" />
						
						<g:sortableColumn property="docnumber" title="${message(code: 'student.docnumber.label', default: 'Docnumber')}" />
										
						<g:sortableColumn property="birthdate" title="${message(code: 'student.birthdate.label', default: 'Birthdate')}" />
						
						<g:sortableColumn property="phonenumber" title="${message(code: 'student.phonenumber.label', default: 'Telefono')}" />
					
						<g:sortableColumn property="status" title="${message(code: 'student.status.label', default: 'Status')}" />
					
					</tr>
				</thead>
				<tbody>
				<g:each in="${studentInstanceList}" status="i" var="studentInstance">
					<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
					
						<td><g:link action="show" id="${studentInstance.id}">${fieldValue(bean: studentInstance, field: "name")}</g:link></td>
					
						<td>${fieldValue(bean: studentInstance, field: "lastname")}</td>
					
						<td><g:if test="${studentInstance?.doctype == '1'}"><g:message code="student.doctype.1"/></g:if>
						<g:if test="${studentInstance?.doctype == '2'}"><g:message code="student.doctype.2"/></g:if>
						<g:if test="${studentInstance?.doctype == '3'}"><g:message code="student.doctype.3"/></g:if>
						</td>
						
						<td>${fieldValue(bean: studentInstance, field: "docnumber")}</td>
					
						<td><g:formatDate date="${studentInstance.birthdate}" /></td>
						
						<td>${fieldValue(bean: studentInstance, field: "phonenumber")}</td>
					
						<td><g:if test="${studentInstance?.status == '1'}"><g:message code="student.status.1"/></g:if>
						<g:elseif test="${studentInstance?.status == '2'}"><g:message code="student.status.2"/></g:elseif>
						<g:elseif test="${studentInstance?.status == '3'}"><g:message code="student.status.3"/></g:elseif>
						</td>
					
					</tr>
				</g:each>
				</tbody>
			</table>
			<div class="pagination">
				<g:paginate total="${studentInstanceTotal}" />
			</div>
			<fieldset class="buttons">
					<g:link class="pdf" params="[_format:'PDF']" controller="student" action="savelistc" >Descargar</g:link>
					<g:link class="xls" params="[_format:'XLS']" controller="student" action="savelistc" >Descargar</g:link>
<%--				<g:jasperReport jasper="invoice" controller="receipt" action="pdf/${receiptInstance?.id}" format="xls" name="recibo-${receiptInstance?.id}" description="Descargar" delimiter=" "/>--%>
			</fieldset>
		</div>
	</body>
</html>
